{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 6,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "RAMI_fabsNIR_050_BLK =  [0.04188343, 0.07274452000000001, 0.24100884]\n",
      "RAMI_frefNIR_050_BLK =  [0.033454239999999996, 0.05472391, 0.17891176]\n",
      "RAMI_ftranNIR_050_BLK =  [0.92466233, 0.87253157, 0.5800794]\n",
      "RAMI_fabsNIR_150_BLK =  [0.1334535, 0.22169851000000002, 0.42073783]\n",
      "RAMI_frefNIR_150_BLK =  [0.09744051000000001, 0.15314946000000002, 0.33329437]\n",
      "RAMI_ftranNIR_150_BLK =  [0.76910599, 0.62515203, 0.2459678]\n",
      "RAMI_fabsNIR_250_BLK =  [0.23394282, 0.35396922000000003, 0.46386535]\n",
      "RAMI_frefNIR_250_BLK =  [0.15761001, 0.2319992, 0.39099052]\n",
      "RAMI_ftranNIR_250_BLK =  [0.60844717, 0.41403157999999995, 0.14514412999999998]\n",
      "RAMI_fabsNIR_050_MED =  [0.054370659999999994, 0.08547336, 0.25007769]\n",
      "RAMI_frefNIR_050_MED =  [0.21168520000000002, 0.22133924, 0.28852533]\n",
      "RAMI_ftranNIR_050_MED =  [0.9340088299999999, 0.8821422699999999, 0.58716846]\n",
      "RAMI_fabsNIR_150_MED =  [0.16424751, 0.24776159, 0.43111234000000004]\n",
      "RAMI_frefNIR_150_MED =  [0.21422398999999998, 0.24624797999999998, 0.36978966999999996]\n",
      "RAMI_ftranNIR_150_MED =  [0.79094998, 0.6439175699999999, 0.2533698]\n",
      "RAMI_fabsNIR_250_MED =  [0.27409287, 0.38176366, 0.473585]\n",
      "RAMI_frefNIR_250_MED =  [0.22649945, 0.27795485, 0.40721736999999997]\n",
      "RAMI_ftranNIR_250_MED =  [0.63554044, 0.43303829, 0.15168952000000002]\n",
      "RAMI_fabsNIR_050_SNW =  [0.07514770999999999, 0.10651483, 0.26529625]\n",
      "RAMI_frefNIR_050_SNW =  [0.50400231, 0.49535178, 0.46933011999999996]\n",
      "RAMI_ftranNIR_050_SNW =  [0.9495712500000001, 0.89831541, 0.59876721]\n",
      "RAMI_fabsNIR_150_SNW =  [0.21784508, 0.29322135, 0.44918252000000003]\n",
      "RAMI_frefNIR_150_SNW =  [0.41475434, 0.40704062, 0.43282195]\n",
      "RAMI_ftranNIR_150_SNW =  [0.82897242, 0.67630421, 0.2662354]\n",
      "RAMI_fabsNIR_250_SNW =  [0.34668661, 0.4322433, 0.49112654999999994]\n",
      "RAMI_frefNIR_250_SNW =  [0.34992203000000005, 0.36066338000000003, 0.43639102]\n",
      "RAMI_ftranNIR_250_SNW =  [0.68454729, 0.46726832, 0.16354338]\n"
     ]
    }
   ],
   "source": [
    "import glob\n",
    "\n",
    "rad_part = [\"fabs\",\"fref\",\"ftran\"]\n",
    "SZA = [\"27\",\"60\",\"83\"]\n",
    "soil = [\"BLK\",\"MED\",\"SNW\"]\n",
    "canopy = [\"SHR\",\"OFC\"]\n",
    "LAI = [\"050\",\"150\",\"250\"]\n",
    "\n",
    "for j in soil:\n",
    "    for k in LAI: \n",
    "        for i in rad_part:  \n",
    "            SZA_hold = []\n",
    "            for m in SZA:   \n",
    "                txtfiles = []\n",
    "                for file in glob.glob(\"/Users/braghier/Documents/CliMA/spartacus_vegetation-1.1/RAMI4PILPS/\" + str(i) + \"_RAMI4PILPSREF-OFC\"+str(k)+\"_\"+str(j)+\"_UNI_NIR_\"+str(m)+\".mes\"):\n",
    "                    txtfiles.append(file)                   \n",
    "                    #print(file)\n",
    "                    f = open(file,\"r\")\n",
    "                    lines = f.readlines()\n",
    "                    result = []\n",
    "                    for x in lines:\n",
    "                        result.append(x.split('\\t')[0])\n",
    "                        #RAMI_absRed_050_BLK\n",
    "                        SZA_hold.append(float(result[0])/100.)\n",
    "                        if(len(SZA_hold) == 3):\n",
    "                            print(\"RAMI_\"+ str(i) + \"NIR_\" + str(k) + \"_\" + str(j) + \" = \", SZA_hold)\n",
    "                    f.close()\n",
    "    \n",
    "    "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.7.6"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 4
}
